/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;

/**
 * <p>Project: app2022 - Ex
 * <p>Powered by webrx On 2022-01-13 15:58:12
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Ex {
    public static void main(String[] args) throws ScriptException {
        Random rand = new Random();
        String[] o = {"", "+", "-"};
        StringBuilder sbu = new StringBuilder("1");
        Set<String> set = new HashSet<String>();
        ScriptEngine js = new ScriptEngineManager().getEngineByName("js");
        while(set.size()<5) {
            for (int i = 2; i < 9; i++) {
                sbu.append(String.format("%s%d", o[rand.nextInt(o.length)], i));
            }
            sbu.append("9");
            if("100".equals(js.eval(sbu.toString()).toString())){
                //System.out.println(sbu);
                String t = sbu.toString();
                if(set.contains(t)){

                }else{
                    System.out.println(t);
                    set.add(t);
                }
            }
            sbu.delete(0,sbu.length());
            sbu.append("1");
        }

        int n = 0;
        for(String s : set){
            System.out.printf("%d、%s = 100%n",++n,s);
        }

    }
}
